﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace LanguageDetector
{
    public class Language : ILanguage
    {
        int _id;
        public int ID
        {
            get { return _id; }
            set { _id = value > 0 ? value : 0; }
        }

        string _iso2;
        public string ISO2
        {
            get { return _iso2; }
            set { _iso2 = !string.IsNullOrEmpty(value) && value.Length > 5 ? value.Remove(5) : value; }
        }

        string _name;
        public string Name
        {
            get { return _name; }
            set { _name = !string.IsNullOrEmpty(value) && value.Length > 40 ? value.Remove(40) : value; }
        }

        public override string ToString()
        {
            return "Language{ISO2='"+ ISO2 +"',Name='"+ Name +"'}";
        }
    }
}
